package com.geeksaga.domain;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.geeksaga.annotation.PrintToString;
import com.geeksaga.common.util.HtmlUtil;
import com.geeksaga.common.util.Util;

/**
 * @author newbie
 * @since 0.1
 */
public class SpecCode extends BaseObject {

    private static final long serialVersionUID = -4826029782489189274L;
    
    @PrintToString private String sid;
    @PrintToString private String specSid;
    @PrintToString private String projectCode;
    @PrintToString private String userSid;
    @PrintToString private String userPasswd;
    @PrintToString private String userNick;
    @PrintToString private String userIcon;
    @PrintToString private String userIp;
    @PrintToString private String userEmail;
    @PrintToString private String userHomepage;
    @PrintToString private String userCountry;
    @PrintToString private String sourceType;
    @PrintToString private String sourcePackage;
    @PrintToString private String sourceName;
    @PrintToString private String interfaceName;
    @PrintToString private String sourceCode;
    @PrintToString private String fileCnt;
	@PrintToString private String delYn;
    @PrintToString private String registDate;
    @PrintToString private String registTime;
    @PrintToString private String registTimestamp;
    @PrintToString private String modifyDate;
    @PrintToString private String modifyTime;
    @PrintToString private String modifyTimestamp;
    @PrintToString
    private List<SagaFile> fileList = new ArrayList<SagaFile>();
    @PrintToString
    private List<MultipartFile> file = new ArrayList<MultipartFile>();

    public SpecCode() {}
    
    public SpecCode(String sid) {
        this.sid = sid;
    }
    
	public String getIndexingData() {
        StringBuilder sb = new StringBuilder();
        sb.append(getSourcePackage());
        sb.append("\r\n");
        sb.append(getSourceName());
        sb.append("\r\n");
        sb.append(getInterfaceName());
        sb.append("\r\n");
        sb.append(getUserNick());
        sb.append("\r\n");
        sb.append(HtmlUtil.removeTag(getSourceCode()));
        
        Iterator<SagaFile> iterator = getFileList().iterator();
        
        while(iterator.hasNext()) {
            sb.append("\r\n");
            sb.append(iterator.next().getOriginalName());
        }
        
        return sb.toString();
    }
	
	public String getIp() {
		return Util.hideIp(userIp);
	}
    public String getSid() {
        return sid;
    }
    public void setSid(String sid) {
        this.sid = sid;
    }
    public String getSpecSid() {
        return specSid;
    }
    public String getProjectCode() {
		return projectCode;
	}
	public void setProjectCode(String projectCode) {
		this.projectCode = projectCode;
	}
    public void setSpecSid(String specSid) {
        this.specSid = specSid;
    }
    public String getUserSid() {
        return userSid;
    }
    public void setUserSid(String userSid) {
        this.userSid = userSid;
    }
    public String getUserPasswd() {
        return userPasswd;
    }
    public void setUserPasswd(String userPasswd) {
        this.userPasswd = userPasswd;
    }
    public String getUserNick() {
        return userNick;
    }
    public void setUserNick(String userNick) {
        this.userNick = userNick;
    }
    public String getUserIcon() {
        return userIcon;
    }
    public void setUserIcon(String userIcon) {
        this.userIcon = userIcon;
    }
    public String getUserIp() {
        return userIp;
    }
    public void setUserIp(String userIp) {
        this.userIp = userIp;
    }
    public String getUserEmail() {
        return userEmail;
    }
    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }
    public String getUserHomepage() {
        return userHomepage;
    }
    public void setUserHomepage(String userHomepage) {
        this.userHomepage = userHomepage;
    }
    public String getUserCountry() {
        return userCountry;
    }
    public void setUserCountry(String userCountry) {
        this.userCountry = userCountry;
    }
    public String getSourceType() {
        return sourceType;
    }
    public void setSourceType(String sourceType) {
        this.sourceType = sourceType;
    }
    public String getSourcePackage() {
        return sourcePackage;
    }
    public void setSourcePackage(String sourcePackage) {
        this.sourcePackage = sourcePackage;
    }
    public String getSourceName() {
        return sourceName;
    }
    public void setSourceName(String sourceName) {
        this.sourceName = sourceName;
    }
    public String getInterfaceName() {
        return interfaceName;
    }
    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }
    public String getSourceCode() {
        return sourceCode;
    }
    public void setSourceCode(String sourceCode) {
        this.sourceCode = sourceCode;
    }
    public String getFileCnt() {
		return fileCnt;
	}
	public void setFileCnt(String fileCnt) {
		this.fileCnt = fileCnt;
	}
    public String getDelYn() {
        return delYn;
    }
    public void setDelYn(String delYn) {
        this.delYn = delYn;
    }
    public String getRegistDate() {
        return registDate;
    }
    public void setRegistDate(String registDate) {
        this.registDate = registDate;
    }
    public String getRegistTime() {
        return registTime;
    }
    public void setRegistTime(String registTime) {
        this.registTime = registTime;
    }
    public String getRegistTimestamp() {
        return registTimestamp;
    }
    public void setRegistTimestamp(String registTimestamp) {
        this.registTimestamp = registTimestamp;
    }
    public String getModifyDate() {
        return modifyDate;
    }
    public void setModifyDate(String modifyDate) {
        this.modifyDate = modifyDate;
    }
    public String getModifyTime() {
        return modifyTime;
    }
    public void setModifyTime(String modifyTime) {
        this.modifyTime = modifyTime;
    }
    public String getModifyTimestamp() {
        return modifyTimestamp;
    }
    public void setModifyTimestamp(String modifyTimestamp) {
        this.modifyTimestamp = modifyTimestamp;
    }
	public List<SagaFile> getFileList() {
		return fileList;
	}
	public void setFileList(List<SagaFile> fileList) {
		this.fileList = fileList;
	}
	public List<MultipartFile> getFile() {
		return file;
	}
	public void setFile(List<MultipartFile> file) {
		this.file = file;
	}
}